﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SharpObjects.SearchEngine.HtmlParsing.Html
{
    public class HtmlImageTag : HtmlTag
    {
        public const string TagName = "img";
        public override string Name { get { return TagName; } set { } }
        public override bool HasText { get { return true;  } set {} }


        public HtmlImageTag(HtmlGenericTag tag = null)
            : base(tag)
        {
        }

        public override string Text
        {
            get
            {
                HtmlAttribute altTextAttribute = this.GetAttribute("alt");
                return altTextAttribute.Value + " " + base.Text;
            }
            set
            {
                base.Text = value;
            }
        }

        public static HtmlTag CreateInstance(HtmlGenericTag tag)
        {
            return new HtmlImageTag(tag);
        }

        public override bool IsContent { get { return true; } set { } }
    }
}
